<%@ taglib prefix="spring-tags" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="spring-form" uri="http://www.springframework.org/tags/form"%>
<%@ page
    import="org.jiscinvolve.astrodabis.barberry.control.Paths"
    import="org.jiscinvolve.astrodabis.barberry.control.ObjectData"
    import="org.jiscinvolve.astrodabis.barberry.control.RequestData"
    import="org.jiscinvolve.astrodabis.barberry.common.core.Job"
    import="org.jiscinvolve.astrodabis.barberry.common.core.Account"
    session="true"
%>
<%
ObjectData<Account> data = (ObjectData<Account>) request.getAttribute(
    RequestData.MODEL_ATTRIB
    ) ;
Account actor = data.actor();
Account user  = data.object();
%>
<html>
    <head>
	    <title>AstroDAbis <%= user.name() %>&apos;s jobs</title>
        <link href='<%= data.file("css/page.css") %>' rel='stylesheet' type='text/css'/>
    </head>
    <body>
        <%@ include file="/jsp/header.jsp" %>
        <div class='body'>
            <div class='left'>
                <%@ include file="/jsp/menu.jsp" %>
            </div>
            <div class='right'>
                <a href='<%= data.link(user, Paths.JOB_PATH) %>'>
                    <img src='<%= data.qrcode(data.link(user, Paths.JOB_PATH)) %>'/>
                </a>
            </div>
            <div class='content'>
                <h2><%= user.name() %>&apos;s data import jobs</h2>
                <%
                if ((actor != null) && (actor.equals(user)))
                    {
                    %>
		            <form method="get" action="<%= data.link(Paths.JOB_CREATE) %>">
		                <button type="submit">New import</button>
		            </form>
                    <hr/>
                    <%
                    }
                %>
                <table>
                    <%
                    for (Job job : user.jobs().select())
                        {
                        %>
                        <tr>
                            <td><a href='<%= data.link(job) %>'><%= job.name() %></a></td>
                            <td><%= job.text() %></td>
                        </tr>
                        <%
                        }
                    %>
                </table>
            </div>
        </div>
        <%@ include file="/jsp/footer.jsp" %>
    </body>
</html>

